package com.tz.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * 账户实体类
 */
@Entity
@Table(name="tbl_account")
public class Account implements Serializable{

	private int id; //PK
	private String num; //账号
	private String password; //密码
	private String realName; //户主
	private double balance;//余额

	public Account() {
	}

	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE,
			generator="myGen")
	@SequenceGenerator(name="myGen",
			sequenceName="tbl_account_seq",
			initialValue=1,
			allocationSize=1)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name="acc_num", nullable=false,unique=true)
	public String getNum() {
		return num;
	}

	public void setNum(String num) {
		this.num = num;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(nullable=false)
	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	@Column(nullable=false)
	public double getBalance() {
		return balance;
	}

	public void setBalance(double balance) {
		this.balance = balance;
	}

	@Override
	public String toString() {
		return "Account [id=" + id + ", num=" + num + ", password=" + password
				+ ", realName=" + realName + ", balance=" + balance + "]";
	}

}
